import { Controller, Get, Header, HttpCode, Post, Req } from '@nestjs/common';
import { AppService } from './app.service';

@Controller()
export class AppController {
  constructor(private readonly appService: AppService) {}

  @Get()
  getHello(): string {
    return this.appService.getHello();
  }

  @Get('a')
  @HttpCode(401)
  getTest(@Req() request: Request): {
    message: string;
    code: number;
    url: string;
  } {
    return {
      message: 'test',
      code: 401,
      url: request.url,
    };
  }

  @Post()
  @Header('Cache-Control', 'max-age=10')
  create(): string {
    return 'This action adds a new cat';
  }
}
